//
//  UIView+Rect.h
//  FinanceProject
//
//  Created by 陈显摆 on 2025/1/15.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

#define  Width   [UIScreen mainScreen].bounds.size.width
#define  Height  [UIScreen mainScreen].bounds.size.height

@interface UIView (Rect)


// Frame
@property (nonatomic) CGPoint viewOrigin;
@property (nonatomic) CGSize  viewSize;

// Frame Origin
@property (nonatomic) CGFloat x;
@property (nonatomic) CGFloat y;

// Frame Size
@property (nonatomic) CGFloat width;
@property (nonatomic) CGFloat height;

// Frame Borders
@property (nonatomic) CGFloat top;
@property (nonatomic) CGFloat left;
@property (nonatomic) CGFloat bottom;
@property (nonatomic) CGFloat right;

// Center Point
#if !IS_IOS_DEVICE
//@property (nonatomic) CGPoint center;
#endif
@property (nonatomic) CGFloat centerX;
@property (nonatomic) CGFloat centerY;

// Middle Point
//@property (nonatomic, readonly) CGPoint middlePoint;
//@property (nonatomic, readonly) CGFloat middleX;
//@property (nonatomic, readonly) CGFloat middleY;


/**
 *  @brief 在Button上添加渐变色layer
 *  @param button 添加到哪个button上
 *  @param width 宽度
 *  @param height 高度
 *  @param cornerRadius 圆角
 *  @param fromColor 渐变色1 传hex
 *  @param toColor 渐变色2 传hex
 *  @param title button的标题
 */
+ (void)addGardientOnButton:(UIButton *)button width:(CGFloat)width height:(CGFloat)height cornerRadius:(CGFloat)cornerRadius fromHexColor:(NSString *)fromColor toHexColor:(NSString *)toColor title:(NSString *)title;

// 这个同上 只是绘制方向是从上到下
+ (void)addGardientTopToBottomOnButton:(UIButton *)button width:(CGFloat)width height:(CGFloat)height cornerRadius:(CGFloat)cornerRadius fromHexColor:(NSString *)fromColor toHexColor:(NSString *)toColor title:(NSString *)title;


#pragma mark - 单独设置圆角
+ (void)setCornerForView:(UIView *)view withRadius:(CGFloat)radius bounds:(CGRect)bounds corners:(UIRectCorner)corners;

@end

NS_ASSUME_NONNULL_END
